#include <bits/stdc++.h>
using namespace std;

void change(int num, string &s){
	int st=0,ed=31;
	while((st<ed&&((num>>ed)&1)==0)) ed--;
	while(st<ed&&(((num>>st)&1)==0)) st++;
	for(int i=ed;i>=st;i--) {
		s+=((num>>i)&1)+'0';
	}
}

void solve(){
	int a, b;
	cin >> a >> b;
	if (b == 0) {
		cout << "Yes" << '\n';
		return;
	}
	string aa, bb;
	change(a, aa);
	change(b, bb);
	int na = aa.size();
	int nb = bb.size();
	// 开始判断字串
	for (int i=0;i<na-nb+1;i++) {
		if (aa[i] == bb[0]) {
			bool flag = true;
			for (int j=0;j<nb;j++) {
				if (aa[i+j] != bb[j]) {
					flag = false;
					break;
				}
			}
			if (flag) {
				cout << "Yes" << '\n';
				return;
			}
		}
	}
	cout << "No" << '\n';
	return;
	
}




signed main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while(t--){
		solve();
	}
	return 0;
}
